//
//  SettingViewController.swift
//  ShouChong
//
//  Created by 陈友文 on 2024/7/11.
//

import UIKit
import SwiftUI
import MMDrawerController

class SettingViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let settingView = SettingView { name in
            self.mm_drawerController.closeDrawer(animated: false, completion: nil)
            let centerVC = self.mm_drawerController.centerViewController.children.first
            if name == "用户中心" {
                let vc = ProfileViewController()
                centerVC?.navigationController?.pushViewController(vc, animated: true)
            } else if name == "数据分析" {
                let vc = DateDetailViewController()
//                self.navigationController?.pushViewController(vc, animated: true)
                centerVC?.navigationController?.pushViewController(vc, animated: true)
//                self.mm_drawerController.centerViewController.navigationController?.pushViewController(vc, animated: true)
            } else if name == "使用日记" {
                let vc = DiaryViewController()
                centerVC?.navigationController?.pushViewController(vc, animated: true)
            } else if name == "活跃L友" {
                let vc = FriendsViewController()
                centerVC?.navigationController?.pushViewController(vc, animated: true)
            } else if name == "系统设置" {
                
            } else if name == "使用说明" {
                let vc = UseHelpViewController()
                centerVC?.navigationController?.pushViewController(vc, animated: true)
            }
        }
        let hostVC = UIHostingController(rootView: settingView)
        hostVC.view.backgroundColor = UIColor(named: "color_bg")
        hostVC.view.frame = kScreenBounds
        self.view.addSubview(hostVC.view)
    }
    

  

}
